package com.cman777.springc.springali.sample.consumer.controller;

import com.cman777.springc.springali.sample.provider.client.IClientA;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenzhicong
 * @time 2020/12/2 9:30
 */
@RestController
public class TestController {
    @Reference
    private IClientA clientA;

    @GetMapping("/greet")
    public String greet(String name) {
        return clientA.greet(name);
    }

    @GetMapping("/testSeata")
    @GlobalTransactional
    public String testSeata() {
        clientA.Step1();
        clientA.Step2();
        return "123";
    }
    @GetMapping("/testSentinel")
    public String testSentinel(){
       return clientA.testSentinel();
    }

}
